<?php
session_start();
function call_stardict_client($args)
{
	$language = isset($_SESSION['language'])?$_SESSION['language']:"";
	if ($language!="") {
		// Translate language:
		$cmd="./stardict-client -L ".$language." ";
	} else {
		$cmd="./stardict-client ";
	}
	$cmd .= $args;
	$handle=popen($cmd, "r");
	$content = "";
	while (!feof ($handle)) {
		$content.= fread ($handle, 2048);
	}
	pclose($handle);
	return $content;
}
?>
